home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / pupworld.swf / scripts / __Packages / Heroes / ThrustBox.as < prev    next >
Encoding:
Text File  |  2011-06-09  |  1.7 KB  |  47 lines

  1. class Heroes.ThrustBox extends Heroes.AnyBox
  2. {
  3.    var myBox;
  4.    function ThrustBox()
  5.    {
  6.       super();
  7.       if(this._parent._parent.facing == "right")
  8.       {
  9.          this.myBox = new Heroes.Box(this._x + this._parent._parent.x,this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2,this._width,this._height,this._width);
  10.       }
  11.       else
  12.       {
  13.          this.myBox = new Heroes.Box(this._parent._parent.x - this._x - this._width,- this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2,this._width,this._height,this._width);
  14.       }
  15.       this.attack();
  16.    }
  17.    function onEnterFrame()
  18.    {
  19.       if(this._parent._parent.facing == "right")
  20.       {
  21.          this.myBox.setLocation(this._x + this._parent._parent.x,this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2);
  22.       }
  23.       else
  24.       {
  25.          this.myBox.setLocation(this._parent._parent.x - this._x - this._width,- this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2);
  26.       }
  27.       this.myBox.setSize(this._width,this._height,this._width);
  28.       this.attack();
  29.    }
  30.    function attack()
  31.    {
  32.       var _loc2_ = this._parent._parent._parent.isHittingWhich(this.myBox);
  33.       if(_loc2_ != null && this._parent._parent._parent[_loc2_]._name != this._parent._parent._name)
  34.       {
  35.          this._parent._parent._parent[_loc2_].dy = this._parent._parent.thrust;
  36.          if(this._parent._parent.facing == "right")
  37.          {
  38.             this._parent._parent._parent[_loc2_].onHit("thrustBox",0,true,- this._parent._parent.thrust);
  39.          }
  40.          else
  41.          {
  42.             this._parent._parent._parent[_loc2_].onHit("thrustBox",0,true,this._parent._parent.thrust);
  43.          }
  44.       }
  45.    }
  46. }
  47.